<?php
session_start();
require_once("twitteroauth/twitteroauth.php");

$twitteruser = "unioninf";
$notweets = 4;
$consumerkey = "Wel2G01qBdXsSRAOqDxZGA";
$consumersecret = "zZqPgeZ3JFb9eEyqXifnTUKoBcXX11bmmxSkfmbrwQ";
$accesstoken = "1606013719-Ibj3WMHAcynKnlxRTNEt8HwCSrlgzzzVYWwEpW4";
$accesstokensecret = "O23g5aCJck3oYPc6RMIylZNTXSZhB1nTcH6Tt2RpA";

function getConnectionWithAccessToken($cons_key, $cons_secret, $oauth_token, $oauth_token_secret) {
	$connection = new TwitterOAuth($cons_key, $cons_secret, $oauth_token, $oauth_token_secret);
	return $connection;
}

$connection = getConnectionWithAccessToken($consumerkey, $consumersecret, $accesstoken, $accesstokensecret);
$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser."&count=".$notweets);

echo json_encode($tweets);
?>